home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 5
/
Amiga Tools 5.iso
/
tools
/
other-tools
/
happyenv
/
mountenv.asm
< prev
next >
Wrap
Assembly Source File
|
1996-06-18
|
3KB
|
139 lines
*****************************************
* MountENV *
* Mount tool for HappyENV-Handler *
* Last change: 18.6.96 *
*****************************************
;See documentation about Copyright&Disclaimer
;Can be started from WB and CLI
;Tabsize=8
;exec
_LVOOpenLibrary = -552
_LVOOldOpenLibrary = -408
_LVOCloseLibrary = -414
_LVOFindTask = -294
_LVOWaitPort = -384
_LVOGetMsg = -372
_LVOReplyMsg = -378
_LVOForbid = -132
_LVOAllocMem = -198
;expansion
_LVOMakeDosNode = -144
_LVOAddDosNode = -150
pr_CLI = 172
pr_MsgPort = 92
pr_CurrentDir = 152
sm_NumArgs = 28
sm_ArgList = 36
dn_Next = 0
dn_Type = 4
dn_Task = 8
dn_Lock = 12
dn_Handler = 16
dn_StackSize = 20
dn_Priority = 24
dn_Startup = 28
dn_SegList = 32
dn_GlobalVec = 36
dn_Name = 40
dn_SIZEOF = 44
;init place for needed structures on stack
start moveq #20,d5 ;set return-code to FAIL
move.l 4.w,a6 ;exec-base to a6
sub.l a1,a1
jsr _LVOFindTask(a6) ;find this task
move.l d0,a4 ;a4=this task
;check for WB or CLI start
moveq #0,d6 ;reset WB-msg
tst.l pr_CLI(a4) ;a4=this task
bne.s .CLI
lea pr_MsgPort(a4),a0 ;it was WB-start
jsr _LVOWaitPort(a6)
lea pr_MsgPort(a4),a0
jsr _LVOGetMsg(a6)
move.l d0,d6 ;d6=message from WB
.CLI moveq #dn_SIZEOF,d0 ;get mem for device node
move.l #1<<16!1,d1
jsr _LVOAllocMem(a6)
tst.l d0
beq.s Ende2
move.l d0,a2
moveq #handend-handler,d0 ;init device node
lea handler(pc),a1
bsr CopyBSTR
beq.s Ende2
move.l d0,dn_Handler(a2)
move.l #2000,dn_StackSize(a2)
moveq #5,d0
move.l d0,dn_Priority(a2)
moveq #-1,d0
move.l d0,dn_GlobalVec(a2)
moveq #envend-envname,d0
lea envname(pc),a1
bsr CopyBSTR
beq.s Ende2
move.l d0,dn_Name(a2)
lea expname(pc),a1 ;open expansion.library
move.l 4.w,a6
jsr _LVOOldOpenLibrary(a6)
tst.l d0
beq.s Ende2
move.l d0,a6
move.l a2,a0 ;add new device node
moveq #0,d0
moveq #0,d1
jsr _LVOAddDosNode(a6)
tst.l d0
beq.s Ende3
moveq #0,d5 ;set return code to OK
;clean up all things used
Ende3 move.l a6,a1
move.l 4.w,a6
jsr _LVOCloseLibrary(a6)
;end program
Ende2 move.l d5,d0 ;set return-code
tst.l d6 ;wb-msg ? -> started from WB
bne.s .Jump
rts ;THE END ! from CLI
.Jump jsr _LVOForbid(a6) ;must be in forbid-state
move.l d6,a1
jmp _LVOReplyMsg(a6) ;THE END ! from WB
CopyBSTR ;entry: d0=size, a1=string
;exit: d0=BSTR
movem.l a0-a2/a6,-(sp)
move.l a1,a2
moveq #1,d1
move.l 4.w,a6
jsr _LVOAllocMem(a6)
move.l d0,a1
lsr.l #2,d0
beq.s .end
.loop move.b (a2)+,(a1)+
bne.s .loop
tst.l d0
.end movem.l (sp)+,a0-a2/a6
rts
expname dc.b "expansion.library",0
handler dc.b 18,"L:HappyENV-Handler",0
handend
envname dc.b 3,"ENV",0
envend
end